/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chatNI;

import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;

/**
 *
 * @author gaye
 */
public abstract class ChatNI {
    //declaration des methoides abstraites      

    public abstract void transmitMessage();

    public static void sendHello(String username,Boolean reply) throws SocketException, UnknownHostException {

       // common.Common.receive(common.Common.toByte(common.MessageFactory.createHello()));
        String broadcast = "255.255.255.255";
        InetAddress broad = InetAddress.getByName(broadcast);
        chatNI.UDPCom com = new chatNI.UDPCom(6666, broad);
        com.sendHello(username,reply);
    }

    public static void sendBye() throws SocketException, UnknownHostException {

      //  common.Common.receive(common.Common.toByte(common.MessageFactory.createBye()));
        String broadcast = "255.255.255.255";
        InetAddress broad = InetAddress.getByName(broadcast);
        chatNI.UDPCom com = new chatNI.UDPCom(6666, broad);
        com.sendBye();
    }
    public static void sendMsg(String text, InetAddress ip) throws SocketException, UnknownHostException{
        chatNI.UDPCom com = new chatNI.UDPCom(6666, ip);
        com.sendMess(text);
    }
    public static void sendTransfertfilereq(String nom, int taille,InetAddress ip)throws SocketException,UnknownHostException, IOException{
         chatNI.UDPCom com = new chatNI.UDPCom(6666, ip);
         com.sendFileReq(nom, taille);
         TCPCom envoi = new TCPCom(5555, nom);
    }
    public static void sendTransfertFileacc(Boolean accept,InetAddress ip)throws SocketException,UnknownHostException{
        chatNI.UDPCom com = new chatNI.UDPCom(6666, ip);
        com.sendFileAcc(accept);
        
    }
}
